<template>
  <div class="machine">
    <div class="machine-left"><MachineLeft :selectVal="selectVal"></MachineLeft></div>
    <div class="machine-right">
      <div style="position: relative" class="machine-number" :popup-max-height="360">
        <div class="text">选择品种:</div>
        <a-dropdown trigger="click" @select="handleSelect">
          <div class="number-select">{{ selectVal }}</div>
          <template #content>
            <a-doption style="width: 120px; zoom: 2" :command="'全部'">全部</a-doption>
            <!-- <a-doption style="width: 120px; zoom: 2" :command="'单一品种'">通用</a-doption> -->
            <a-doption v-for="item in breed" style="zoom: 2" :command="item.breed_name">{{ item.breed_name }}</a-doption>
          </template>
        </a-dropdown>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, computed } from 'vue'
import MachineLeft from './components/machine-left.vue'
import { storeToRefs } from 'pinia'
import useMainStore from '../../store/main/main'
const mainStore = useMainStore()
// mainmachine.getmachineAreaList()
mainStore.getAreaList()
mainStore.getProductList()
mainStore.getBreedList()
const { breed, breedName } = storeToRefs(mainStore)
const selectVal = computed(() => {
  return breedName.value
})
function handleSelect(command) {
  mainStore.changeBreed(command)
}
</script>

<style lang="less" scoped>
:deep(.arco-dropdown-list-wrapper) {
  max-height: 360px;
}
.machine {
  width: 100%;
  display: flex;
  position: relative;
  flex-wrap: wrap;
  align-content: flex-start;
  .machine-left {
    float: left;
    width: 88%;
  }
  .machine-right {
    position: fixed;
    display: flex;
    height: calc(100% - 80px);
    flex-direction: column;
    justify-content: start;
    align-items: center;
    right: 20px;
    .machine-number {
      margin-top: 30px;
      .number-select {
        width: 200px;
        height: 80px;
        font-size: 32px;
        margin: 10px 20px;
        background-color: #157ae3;
        color: #fff;
        text-align: center;
        line-height: 80px;
        border-radius: 6px;
        cursor: pointer;
      }
      .btn-open {
        width: 200px;
        box-sizing: border-box;
        height: 80px;
        font-size: 32px;
        margin: 10px 20px;
        color: #157ae3;
        background-color: #fff;
        text-align: center;
        line-height: 80px;
        border-radius: 6px;
        border: 2px solid #157ae3;
        cursor: pointer;
      }
      .btn-prohibit-active {
        width: 200px;
        height: 80px;
        font-size: 32px;
        margin: 10px 20px;
        background-color: red;
        color: #fff;
        text-align: center;
        line-height: 80px;
        border-radius: 6px;
        border: none;
        cursor: pointer;
      }
      .btn-open-active {
        width: 200px;
        height: 80px;
        font-size: 32px;
        margin: 10px 20px;
        background-color: #157ae3;
        color: #fff;
        text-align: center;
        line-height: 80px;
        border-radius: 6px;
        border: none;
        cursor: pointer;
      }
      .btn-prohibit {
        width: 200px;
        height: 80px;
        font-size: 32px;
        margin: 10px 20px;
        background-color: #ccc;
        color: #fff;
        text-align: center;
        line-height: 80px;
        border-radius: 6px;
        border: none;
        cursor: pointer;
      }
    }
  }
  .text {
    font-size: 26px;
    font-weight: 500;
  }
  .text1 {
    font-size: 20px;
    font-weight: 500;
  }
}
</style>
